//import components
import React from 'react'
import Bundle from './bundle.js'
import Login from './components/Login/Login'
import Home from 'bundle-loader?lazy&name=Home!./components/Home/Home'
import UserInfo from 'bundle-loader?lazy&name=UserInfo!./components/UserInfo/UserInfo'
import UserAuth from 'bundle-loader?lazy&name=UserAuth!./components/UserAuth/UserAuth'
import Module from 'bundle-loader?lazy&name=Module!./components/Module/Module'
import Shop from 'bundle-loader?lazy&name=Shop!./components/Shop/index'
import Classify from 'bundle-loader?lazy&name=Classify!./components/Classify/Classify'
import ItemSchedule from 'bundle-loader?lazy&name=ItemSchedule!./components/ItemSchedule/ItemSchedule'
import ItemFilter from 'bundle-loader?lazy&name=ItemFilter!./components/ItemFilter/ItemFilter'
import ItemBind from 'bundle-loader?lazy&name=ItemBind!./components/ItemBind/ItemBind'
import ItemModify from 'bundle-loader?lazy&name=ItemModify!./components/ItemModify/ItemModify'
import StoreItem from 'bundle-loader?lazy&name=StoreItem!./components/StoreItem/index'
import StoreRelease from 'bundle-loader?lazy&name=StoreRelease!./components/StoreRelease/StoreRelease'
import Order from 'bundle-loader?lazy&name=Order!./components/Order/Order'
import ReportSales from 'bundle-loader?lazy&name=ReportSales!./components/ReportSales/ReportSales'
import ExportRecord from 'bundle-loader?lazy&name=ExportRecord!./components/ExportRecord/index'
import ImportRecord from 'bundle-loader?lazy&name=ImportRecord!./components/ImportRecord/index'
import CategoryLog from 'bundle-loader?lazy&name=CategoryLog!./components/LogQuery/CategoryLog/index'
import ShopLog from 'bundle-loader?lazy&name=ShopLog!./components/LogQuery/ShopLog/index'
import ShopItemLog from 'bundle-loader?lazy&name=ShopItemLog!./components/LogQuery/ShopItemLog/index'
import InventoryLog from 'bundle-loader?lazy&name=ShopItemLog!./components/LogQuery/InventoryLog/index'

// Each logical "route" has two components, one for
// the sidebar and one for the main area. We want to
// render both of them in different places when the
// path matches the current URL.

const bundleComponent = (Component) => {
  return (props) => (
      <Bundle load={Component}>
        {(Container) => <Container {...props}/>}
      </Bundle>
  )
}

const routes = [
  // { path: '/',
  //   exact: true,
  //   component: Login
  // },
  { path: '/login',
    exact: true,
    component: Login
  },
  { path: '/index',
    exact: true,
    component: bundleComponent(Home)
  },
  { path: '/user/info',
    exact: true,
    component: bundleComponent(UserInfo)
  },
  { path: '/user/auth',
    exact: true,
    component: bundleComponent(UserAuth)
  },
  { path: '/user/module',
    exact: true,
    component: bundleComponent(Module)
  },
  { path: '/shop',
    component: bundleComponent(Shop)
  },
  { path: '/classify',
    component: bundleComponent(Classify)
  },
  { path: '/item/schedule',
    component: bundleComponent(ItemSchedule)
  },
  { path: '/item/filter',
    component: bundleComponent(ItemFilter)
  },
  { path: '/item/bind',
    component: bundleComponent(ItemBind)
  },
  { path: '/item/modify/:itemId',
    component: bundleComponent(ItemModify)
  },
  { path: '/store/item',
    component: bundleComponent(StoreItem)
  },
  { path: '/store/release',
    component: bundleComponent(StoreRelease)
  },
  { path: '/order',
    component: bundleComponent(Order)
  },
  { path: '/report/sales',
    component: bundleComponent(ReportSales)
  },
  { path: '/record/export',
    component: bundleComponent(ExportRecord)
  },
  { path: '/record/import',
    component: bundleComponent(ImportRecord)
  },
  { path: '/log/category',
  component: bundleComponent(CategoryLog)
  },
  { path: '/log/shopItem',
  component: bundleComponent(ShopItemLog)
  },
  { path: '/log/shop',
  component: bundleComponent(ShopLog)
  },
  { path: '/log/inventory',
  component: bundleComponent(InventoryLog)
  },
  { path: 'notMatch',
  },
]


export default routes